package com.ruoyi.miaomiao.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.miaomiao.mapper.CommonUserMapper;
import com.ruoyi.miaomiao.domain.CommonUser;
import com.ruoyi.miaomiao.service.ICommonUserService;

/**
 * miaomiao用户管理Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-07-26
 */
@Service
public class CommonUserServiceImpl implements ICommonUserService 
{
    @Autowired
    private CommonUserMapper commonUserMapper;

    /**
     * 查询miaomiao用户管理
     * 
     * @param userId miaomiao用户管理主键
     * @return miaomiao用户管理
     */
    @Override
    public CommonUser selectCommonUserByUserId(Long userId)
    {
        return commonUserMapper.selectCommonUserByUserId(userId);
    }

    @Override
    public CommonUser selectCommonUserByOpenId(String openId) {
        return  commonUserMapper.selectCommonUserOpenId(openId);
    }

    /**
     * 查询miaomiao用户管理列表
     * 
     * @param commonUser miaomiao用户管理
     * @return miaomiao用户管理
     */
    @Override
    public List<CommonUser> selectCommonUserList(CommonUser commonUser)
    {
        return commonUserMapper.selectCommonUserList(commonUser);
    }

    /**
     * 新增miaomiao用户管理
     * 
     * @param commonUser miaomiao用户管理
     * @return 结果
     */
    @Override
    public int insertCommonUser(CommonUser commonUser)
    {
        commonUser.setCreateTime(DateUtils.getNowDate());
        commonUser.setUpdateTime(DateUtils.getNowDate());
        return commonUserMapper.insertCommonUser(commonUser);
    }

    /**
     * 修改miaomiao用户管理
     * 
     * @param commonUser miaomiao用户管理
     * @return 结果
     */
    @Override
    public int updateCommonUser(CommonUser commonUser)
    {
        commonUser.setUpdateTime(DateUtils.getNowDate());
        return commonUserMapper.updateCommonUser(commonUser);
    }

    /**
     * 批量删除miaomiao用户管理
     * 
     * @param userIds 需要删除的miaomiao用户管理主键
     * @return 结果
     */
    @Override
    public int deleteCommonUserByUserIds(Long[] userIds)
    {
        return commonUserMapper.deleteCommonUserByUserIds(userIds);
    }

    /**
     * 删除miaomiao用户管理信息
     * 
     * @param userId miaomiao用户管理主键
     * @return 结果
     */
    @Override
    public int deleteCommonUserByUserId(Long userId)
    {
        return commonUserMapper.deleteCommonUserByUserId(userId);
    }
}
